<template>
  <transition
    enter-active-class="animate__animated animate__fadeIn"
    leave-active-class="animate__animated animate__fadeOut"
  >
    <div class="sms-dialog" v-show="visible">
        <div class="sms-con">
            <h6>请输入验证码</h6>
            <div class="code-wrap">
                <ul class="nums">
                    <li :class="{'active':index < checkCode.length}" v-for="(item,index) in len" :key="item">{{checkCode[index]}}</li>
                </ul>
                <input type="text" v-model="checkCode">
            </div>
            <button @click="login">登录</button>
        </div>
    </div>
  </transition>
</template>

<script>
export default {
    props:{
        visible:{
            type:Boolean,
            default:false
        }
    },
    data(){
        return {
            checkCode:'',
            len:6
        }
    },
    methods: {
        login(){
            this.$emit("login",this.checkCode)
        }
    },
}
</script>

<style lang="scss" scoped>
    .sms-dialog{
        @include size(100%,100%);
        position:absolute;
        top:0;
        left:0;
        z-index:9;
        background: rgba(0,0,0,.6);
        .sms-con{
            @include centerer();
            background: #fff;
            border-radius: 10px;
            padding:10px;
        }

        .code-wrap{
            position: relative;
            input{
                width:100%;
                height: 34px;
                position: absolute;
                top:0;
                left:0;
                outline: none;
                border:none;
                background: transparent;
                opacity: 0;
            }
        }

        .nums{
            width:100%;
            display: flex;
            li{
                width:34px;
                height: 34px;
                border:1px solid gray;
                margin:0 4px;
            }
            .active{
                border-color:red;
            }
        }
    }
</style>







